package com.zaoqi.repository;

import com.zaoqi.pojo.User;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.springframework.data.domain.Pageable;
import java.util.Optional;

@Repository
public interface UserRepository extends JpaRepository<User, Integer> {
    // 根据用户名查询用户
    Optional<User> findByUsername(String username);
    // 按用户名模糊查询并分页
    Page<User> findByUsernameContaining(String username, Pageable pageable);
    // 根据用户名和密码查询用户
    Optional<User> findByUsernameAndPassword(String username, String password);
}
